<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/jsp/base/taglibs.jsp"%>
<%@include file="/WEB-INF/jsp/base/head.jsp"%> 
<html>
<head>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/js/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
<script type="text/javascript">
$(function() {
	$(".example").each(function(index){
		$(this).fancybox();
	});
	$("#addFile").click(function(){
		var html ='<div><label class="lab">选择相片：</label><s:file name="files" ></s:file><input type="button" name="delFile" style="padding: 5px 10px 5px 10px;" value="-"></div>';
		$("#file_add_div").append(html);
	});
	$("input[name='delFile']").live("click",function(){
		$(this).parent().remove();
	});
	
	$(".delete").each(function(){
		var temp = $(this);
		temp.click(function(){
		 	if(confirm("您确定要删除选中的数据吗？")) {
		 		$("#id").val(temp.attr("tempId"));
		 		$("[name='form1']").attr("action",$("#url").val());
		 		$("[name='form1']").submit();
	 		}
		});
	});
});
</script>
<title>餐厅主图</title>
</head>
<body>
   <s:form action="restaurantPhotoAction!restaurantMainPhotoAdd" namespace="/restaurantPhoto" name="form1" method="post" enctype="multipart/form-data">
   		<input type="hidden" name="rid" value="${rid}" />
   		<input type="hidden" id="id" name="id" value="${id}" />
   		<input type="hidden" id="url" value="<%=request.getContextPath() %>/restaurantPhoto/restaurantPhotoAction!restaurantMainPhotoDelete.do" />
   		<div >
	      	<label class="lab">选择相片：</label><s:file name="files"></s:file><input type="button" value="+" style="padding: 5px 8px 5px 8px;" id="addFile">
	      	<s:submit value="保存" action="restaurantPhotoAction" cssStyle="padding: 5px;" method="restaurantMainPhotoAdd"></s:submit>
	      	<label class="error" >*&nbsp;&nbsp;<s:property value="%{errors['success'][0]}"/></label>
		</div>
		<div id="file_add_div"></div>
	   <s:iterator value="restaurantPhotoBizBeans" status="sta">
	   		<div style="float: left;margin: 5px;text-align: center;">
		   		<a class="example" href="<%=request.getContextPath() %>/restaurant${path}">
			   		<img src="<%=request.getContextPath() %>/restaurant${path}" width="300px" height="200px" />
			   	</a><br/>
			   	<input type="button" class="delete" value="删除" tempId="${id}" style="padding: 5px"/>
	   		</div>
	   </s:iterator>
   </s:form>
</body>
</html>